package com.zfp.sys.service;

import com.zfp.core.service.BaseService;
import com.zfp.core.utils.Md5Util;
import com.zfp.sys.dao.SysAccountDao;
import com.zfp.sys.entity.SysAccount;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;

/**
 * Created by Administrator on 2017/8/1.
 */
@Service("sysAccountService")
public class SysAccountService extends BaseService<SysAccount> {
    @Autowired
    SysAccountDao sysAccountDao;

    public String editPassword(SysAccount sysAccount){
        String msg = "true";
        SysAccount sysAccount1 = sysAccountDao.getById("SysAccount.getById",(sysAccount.getUserId()).toString());
        if(Md5Util.md5L32(sysAccount.getOldPassword()).equals(sysAccount1.getPassword())){
            sysAccount.setPassword(Md5Util.md5L32(sysAccount.getNewPassword()));
            sysAccountDao.update(sysAccount);
        }else{
            msg = "false";
        }

        return msg;
    }
}
